﻿using System.Collections.Generic;
using System.Linq;
using OSCSchema;

namespace OSC.Base
{
    public class List : IActivityDetail
    {
        private readonly string m_Name;
        private IList<IListItem> m_Items;

        public List(string name)
        {
            m_Name = name;
            m_Items = new List<IListItem>();
        }

        public void Add(IListItem item)
        {
            m_Items.Add(item);
        }

        public templateVariableType ToTemplateVariableType()
        {
            return new templateVariableType
                       {
                           name = m_Name,
                           listItems = m_Items.Select(
                               item => item.ToSimpleTemplateVariableType()
                               ).ToArray()
                       };
        }
    }
}